<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title>个人中心</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="css/style.css" rel="stylesheet" type="text/css"/>

        <script type="text/javascript" src="../js/jquery.min.js"></script>

        <script src="${pageContext.request.contextPath}/manager_page/layui/layui.js"></script>

        <style type="text/css">
            .head_color{
                background-color: #01a474;
            }
        </style>

    </head>
    <body>


        <section class="aui-flexView">
            <section class="aui-scrollView">
                <div class="aui-flex  head_color">

                    <div class="aui-flex-users">
                        <a href="javascript:toPerson_inside();">
                        <img  alt="" id="user_head_img">
                        </a>
                    </div>
                    <div class="aui-flex-box">
                        <a href="javascript:toPerson_inside();"> <h3><%=request.getParameter("user_name_show")%></h3></a>
                    </div>
                </div>
                <div class="aui-layout b-line">
                    <a href="javascript:to_test_tongji();" class="aui-layout-item">
                        做题数<b id="question_did_num">0</b>
                    </a>
                    <a href="javascript:to_did_class('收藏');" class="aui-layout-item">
                        收藏题<b id="question_collect_num">0</b>
                    </a>
                    <a href="javascript:to_did_class('错题');" class="aui-layout-item">
                        错题<b id="question_wrong_num">0</b>
                    </a>
                </div>
                <div class="aui-layout aui-layout-two">
                    <a href="javascript:to_test_tongji();" class="aui-layout-item">
                        <div class="aui-layout-icon">
                            <img src="images/icon-my-001.png" alt="">
                        </div>
                        <div class="aui-layout-text">试题统计</div>
                    </a>
                    <a href="javascript:to_mygrade();" class="aui-layout-item">
                        <div class="aui-layout-icon">
                            <img src="images/icon-my-002.png" alt="">
                        </div>
                        <div class="aui-layout-text">考试记录</div>
                    </a>
                    <a href="javascript:to_grade_rank();" class="aui-layout-item">
                        <div class="aui-layout-icon">
                            <img src="images/icon-my-003.png" alt="">
                        </div>
                        <div class="aui-layout-text">成绩排行</div>
                    </a>
                </div>
                <div class="divHeight"></div>
                <div class="aui-course-list">
                    <a href="javascript:to_did_class('收藏');" class="aui-flex b-line">
                        <div class="aui-cou-img">
                            <img src="images/icon-fl-001.png" alt="">
                        </div>
                        <div class="aui-flex-box">
                            <p>我的收藏</p>
                        </div>
                    </a>
                    <a href="javascript:to_did_class('错题');" class="aui-flex b-line">
                        <div class="aui-cou-img">
                            <img src="images/icon-fl-004.png" alt="">
                        </div>
                        <div class="aui-flex-box">
                            <p>我的错题</p>
                        </div>
                    </a>
                    <a href="javascript:to_comment();" class="aui-flex b-line">
                        <div class="aui-cou-img">
                            <img src="images/icon-fl-003.png" alt="">
                        </div>
                        <div class="aui-flex-box">
                            <p>我的评论</p>
                        </div>
                    </a>
                    <div class="divHeight"></div>
                    <a href="javascript:to_note();" class="aui-flex b-line">
                        <div class="aui-cou-img">
                            <img src="images/icon-fl-005.png" alt="">
                        </div>
                        <div class="aui-flex-box">
                            <p>我的笔记</p>
                        </div>
                    </a>
                </div>

            </section>
            <footer class="aui-footer">
                <a href="../index.jsp" class="aui-tabBar-item ">
                    <span class="aui-tabBar-item-icon">
                        <img src="images/home.png" width="20" height="20" alt="">
                    </span>
                    <span class="aui-tabBar-item-text">首页</span>
                </a>
                <a href="javascript:;" class="aui-tabBar-item aui-tabBar-item-active">
                    <span class="aui-tabBar-item-icon">
                        <img src="images/person_active.png" width="20" height="20" alt="">
                    </span>
                    <span class="aui-tabBar-item-text">我的</span>
                </a>

            </footer>
        </section>



    </body>
    <script>

        var layer;
        layui.use('layer',function(){
            layer=layui.layer;
        })

        window.onload=function(){
            initUser_info();
        }
        function initUser_info(){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_user/user_init_person.do",
                success:function(data,status){
                    if(status=="success"){
                        var path="${pageContext.request.contextPath}/img_artificial/user_img/"
                        $("#user_head_img").attr("src",path+data.head_img);
                        $("#question_did_num").text(data.did);
                        $("#question_collect_num").text(data.collect);
                        $("#question_wrong_num").text(data.wrong);
                    }
                }
            })
        }



        function toPerson_inside(){
            <%--window.location.href="${pageContext.request.contextPath}/check_login_person_inside.do";--%>
            $.ajax({
                url:"${pageContext.request.contextPath}/check_login_person_inside.do",
                success:function(data,status){
                    if(status==="success"){
                        if(data===1){
                            // alert("有用户登录，跳转到详情页面");
                            window.location.href="person_inside/person_inside.jsp";
                        }else{
                            alert("您还没登录，即将跳往登录页面");
                            window.location.href="../login_page/login_page.jsp";
                        }
                    }
                }
            });
        }

        function to_did_class(did_class_hidden){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_other/check_login.do",
                success:function(data,status){
                    if(status=="success"){
                        if(data==0)
                            layer.alert("您需要先登录");
                        else
                            window.location.href="${pageContext.request.contextPath}/page/myerrors.jsp?did_class_hidden="+did_class_hidden;
                    }
                }
            })
        }

        function to_test_tongji(){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_other/check_login.do",
                success:function(data,status){
                    if(status=="success"){
                        if(data==0)
                            layer.alert("您需要先登录");
                        else{
                            // layer.alert("此功能正在研发中...");
                            window.location.href="${pageContext.request.contextPath}/page/test_tongji.jsp";
                        }
                    }
                }
            })
        }
        function to_mygrade(){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_other/check_login.do",
                success:function(data,status){
                    if(status=="success"){
                        if(data==0)
                            layer.alert("您需要先登录");
                        else{
                            // layer.alert("此功能正在研发中...");
                            window.location.href="${pageContext.request.contextPath}/page/mygrade.jsp";
                        }
                    }
                }
            })
        }
        function to_grade_rank(){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_other/check_login.do",
                success:function(data,status){
                    if(status=="success"){
                        if(data==0)
                            layer.alert("您需要先登录");
                        else{
                            // layer.alert("此功能正在研发中...");
                            window.location.href="${pageContext.request.contextPath}/page/grade_rank.jsp";
                        }
                    }
                }
            })
        }
        function to_comment(){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_other/check_login.do",
                success:function(data,status){
                    if(status=="success"){
                        if(data==0)
                            layer.alert("您需要先登录");
                        else{
                            layer.alert("此功能正在研发中...");
                        }
                    }
                }
            })
        }
        function to_note(){
            $.ajax({
                url:"${pageContext.request.contextPath}/front_other/check_login.do",
                success:function(data,status){
                    if(status=="success"){
                        if(data==0)
                            layer.alert("您需要先登录");
                        else{
                            layer.alert("此功能正在研发中...");
                        }
                    }
                }
            })
        }
    </script>
</html>
